package com.realtest.baidu;

import java.sql.SQLOutput;
import java.util.Random;
import java.util.Scanner;

/**
 * @Author: Ethan Yankang
 * @Program: Interview
 * @Date: 2024-08-23 21:40
 **/

public class Diff {
    public static void main(String[] args) {
        Random random = new Random();

        Scanner scanner = new Scanner(System.in);

        // 输入 n 和 m
        int n = scanner.nextInt();
        int m = scanner.nextInt();

        // 初始化差分数组，长度为 n+1
        int[] diff = new int[n + 1];

        // 处理每个操作
        for (int i = 0; i < m; i++) {
            int l = scanner.nextInt();
            int r = scanner.nextInt();
            int v = scanner.nextInt();

            // 使用差分数组进行区间更新,每输入一次更新一次，这时间复杂度太少了吧！！！
            diff[l] += v;
            if (r + 1 <= n) {
                diff[r + 1] -= v;
            }
        }

        // 构建最终的数组 arr
        int[] arr = new int[n];
        arr[0] = diff[1]; // 注意：diff数组是从1开始的,所以前面要n+1

        for (int i = 2; i <= n; i++) {
            arr[i - 1] = arr[i - 2] + diff[i];
        }

        // 输出结果数组
        for (int i = 0; i < n; i++) {
            System.out.print(arr[i] + " ");
        }
    }
}
